function de = bin2dec(bi)
  //convert binary number sequence to decimal number
  len = size(bi,1);
  len2 = size(bi,2);
  de = zeros(len, 1);
  for i = 1:len
    weight = 1;
    for j = 1:len2
      de(i) = de(i) + bi(i,j) * weight;
      weight = weight * 2;
    end
  end
endfunction

